<html>
<head>
    <meta charset="utf-8">
    <title>会员卡</title>
    {php include $this->template($this->cur_tpl.'/_common_meta');}
    <link rel="stylesheet" type="text/css" href="{RES}mobile/{php echo $this->cur_tpl}/css/main.css" media="all">
    <link rel="stylesheet" type="text/css" href="{RES}mobile/{php echo $this->cur_tpl}/css/dialog.css" media="all">
    <script type="text/javascript" src="{RES}mobile/{php echo $this->cur_tpl}/js/jquery_min.js"></script>
    <script type="text/javascript" src="{RES}mobile/{php echo $this->cur_tpl}/js/main.js"></script>
    <script type="text/javascript" src="{RES}mobile/{php echo $this->cur_tpl}/js/calendar.js"></script>
    <script type="text/javascript" src="{RES}mobile/{php echo $this->cur_tpl}/js/dialog_min.js"></script>
</head>

<body onselectstart="return true;" ondragstart="return false;" style="">
<style type="text/css">
    .Calendar {
        font-family: Verdana;
        background-color: #EEE;
        text-align: center;
        height: 320px;
        line-height: 1.5em;
    }

    .Calendar .icons {
        display: block;
        width: 40px;
        height: 40px;
        background: url({RES}mobile/style1/images/icons4.png) no-repeat center -300px;
        -webkit-background-size: 50px auto;
    }

    .Calendar .icons_after {
        background-position: center -350px;
    }

    .Calendar header {
        font-size: 14px;
        color: #888e8e;
        line-height: 50px;
        height: 50px;
        background: #ffffff;
        box-shadow: 0 5px 5px rgba(100, 100, 100, 0.1);
    }

    .Calendar a {
        color: #0066CC;
    }

    .Calendar table {
        width: 280px;
        margin: auto;
        border: 0;
    }

    .Calendar table thead {
        color: #acacac;
    }

    .Calendar table td {
        color: #989898;
        border: 1px solid #ecf9fa;
        width: 40px;
        height: 40px;
        margin: 1px;
        background: #ffffff;
        -webkit-box-sizing: border-box;
        text-align: center;
    }

    .Calendar thead td, .Calendar td:empty {
        background: none;
        border: 0;
    }

    .Calendar thead td {
        color: #72bec9;
        font-size: 13px;
        font-weight: bold;
    }

    #idCalendarPre {
        cursor: pointer;
        float: left;
    }

    #idCalendarNext {
        cursor: pointer;
        float: right;
    }

    #idCalendar td a.checked {
        display: block;
        height: 100%;
        border: 1px solid #58c4d1;
        line-height: 38px;
        color: #989898;
    }

    #idCalendar td.onToday, #idCalendar td.onToday a {
        color: #ff3600 !important;
    }

    .tbox_other {
        width: 100%;
    }
    .tbox_other > * {
        height: 100%;
        display: table-cell;
        vertical-align: top;
    }
    .tbox_other > *:last-child {
        width: 100%;
    }

    .tbox_1 li{
        height:150px;
        vertical-align: middle;
        text-align:center;
    }
    .tbox_1 li:nth-of-type(2){width:100%;}
    .tbox_1 li:nth-of-type(2) a{
        display: block;
        width:100px;
        height:100px;
        border:5px solid #bde0e2;
        background:#5ac5d4;
        color:#ffffff;
        font-size:23px;
        padding-top:31px;
        font-weight: 800;
        -webkit-box-sizing:border-box;
        border-radius:80px;
        margin: auto;
    }

    .tbox_1 li p{
        font-size:14px;
        width:80px;
        margin:auto 5px;
    }
    .tbox_1 li p label{
        display: block;
        color:#5ac5d4;
        font-size: 18px;
    }
</style>
<script>
    /**
     * 积分签到
     */
    function dosignin() {
        //提交信息
        $.ajax({
            type: "post",
            url: "{php echo $this->createMobileUrl('signin')}",
            dataType: "json",
            success: function (data) {
                if (data.status  == 0) {
                    alert(data.message, 1500);
                    url = "{php echo $this->createMobileUrl('sign')}";
                    setTimeout("location.href='" + url + "'", 1500);
                } else {
                    alert(data.message, 1500);
                }
            }
        });
    }
</script>
<div class="container integral">
    <header>
        <ul class="tbox_other tbox_1">
            <li>
                <p class="pre">
                    <label>{$balance_score}</label>
                    可用积分
                </p>
            </li>
            {if $issign==1}
            <li>
                <a href="javascript:void(0)"><label>已签到</label></a>
            </li>
            {else}
            <li>
                <a href="javascript:void(0)" onclick="dosignin()"><label>签到</label></a>
            </li>
            {/if}
            <li>
                <p class="pre">
                    <label>{$signCount}</label>
                    月签到次数
                </p>
            </li>
        </ul>
        <nav class="nav_integral">
            <ul class="box">
                <li>
                    <a href="{php echo $this->createMobileUrl('exchangelist')}">
                        <span class="icons icons_prize">&nbsp;</span><label>兑换礼品</label></a></li>
                <!--<li>-->
                    <!--<a href="#" onclick="alert('研发中,近几日放出！', 1000);return false;">-->
                        <!--<span class="icons icons_luck">&nbsp;</span><label>积分抽奖</label></a>-->
                <!--</li>-->
                <li><a href="{php echo $this->createMobileUrl('signlist')}">
                    <span class="icons icons_record">&nbsp;</span><label>签到记录</label></a></li>
                <li>
                    <a href="{php echo $this->createMobileUrl('scoreteach')}">
                        <span class="icons icons_teach">&nbsp;</span><label>积分攻略</label></a></li>
            </ul>
        </nav>
    </header>
    <div class="body">
        <div>
            <div class="Calendar">
                <header>
                    <div id="idCalendarPre"><span class="icons icons_before">&nbsp;</span></div>
                    <div id="idCalendarNext"><span class="icons icons_after">&nbsp;</span></div>
                    <span id="idCalendarYear" style="color: #373B3E;">0</span>年 <span id="idCalendarMonth" style="color: #373B3E;">0</span>月
                </header>
                <table cellspacing="0">
                    <thead>
                    <tr>
                        <td>日</td>
                        <td>一</td>
                        <td>二</td>
                        <td>三</td>
                        <td>四</td>
                        <td>五</td>
                        <td>六</td>
                    </tr>
                    </thead>
                    <tbody id="idCalendar">
                    </tbody>
                </table>
            </div>
            <script language="JavaScript">
                var cale = new Calendar("idCalendar", {
                    Year: {$year},//
                    Month: {$month},//
                    onToday: function (o) {
                        o.className = "onToday";
                    },
                    onFinish: function () {
                        this.Year = {$year};
                        this.Month = {$month};
                        $$("idCalendarYear").innerHTML = this.Year;
                        $$("idCalendarMonth").innerHTML = this.Month;
                        var flag = {$sign_list};
                        for (var i = 0, len = flag.length; i < len; i++) {
                            this.Days[flag[i]].innerHTML = "<a href='javascript:void(0);' class='checked'>" + flag[i] + "</a>";
                        }
                    }
                });

                $$("idCalendarPre").onclick = function () {
                    var m = {$month};
                    m = m - 1;
                    var year = {$year};
                    if (m == 0){
                        year = {$year} - 1;
                        m = 12;
                    }
                    location.href = "{php echo $this->createMobileUrl('sign', array(), true)}" + '&month=' + m + '&year=' + year + "";
                }
                $$("idCalendarNext").onclick = function () {
                    var m = {$month};
                    m = m + 1;
                    var year = {$year};
                    if (m > 12) {
                        year = {$year} + 1;
                        m = 1;
                    }
                    location.href = "{php echo $this->createMobileUrl('sign', array(), true)}" + '&month=' + m + '&year=' + year;
                }
            </script>
        </div>
    </div>
    <script type="text/javascript">
        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
            WeixinJSBridge.call('hideToolbar');
        });
    </script>
    {if !empty($card)}
    {php include $this->template($this->cur_tpl.'/_footer');}
    {/if}
</div>
</body>
</html>